/**
 * 
 */
package dao;

import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import utils.Const;
import com.j256.ormlite.dao.Dao;
import database.DatabaseHelper;
import entity.Plan;
import entity.Report;

/**
 * @author Hung
 *
 */
public class ReportDAO {
	
	private Dao<Report, Integer> dao = null;
	
	public ReportDAO(DatabaseHelper helper) throws Exception {
		dao = helper.getReportDao();
		if (dao == null)
			throw new Exception(Const.NULL_DAO_ERROR);
	}
	
	public int createReport(Report report) throws SQLException {
		return dao.create(report);
	}
	
	public int updateReport(Report report) throws SQLException {
		return dao.update(report);
	}
	
	public int deleteReport(Report report) throws SQLException {
		return dao.delete(report);
	}
	
	public Report getReportById(int id) throws SQLException {
		return dao.queryForId(id);
	}
	
//	public List<Report> getReportFromDateToDate(Date beginDate, Date endDate) {
//		Map<String, Object> map = new HashMap<String, Object>();
//		map.put("beginDate", beginDate);
//		map.put("endDate", endDate);
//		dao.query
//	}
}
